home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / dev / gcc / gcc270_readme.lha / gnu / GCC-Install < prev    next >
Text File  |  1995-08-24  |  44KB  |  1,487 lines

  1. ;;; -*- Lisp-Interaction -*-
  2. ;;; Version: $VER: GCC-Install 2.11 (22.08.95)
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4. ;;;
  5. ;;;  GNU C Installation script for AmigaDOS
  6. ;;;
  7. ;;;  This program is free software; you can redistribute it and/or modify
  8. ;;;  it under the terms of the GNU General Public License as published by
  9. ;;;  the Free Software Foundation; either version 2 of the License, or
  10. ;;;  (at your option) any later version.
  11. ;;;
  12. ;;;  This program is distributed in the hope that it will be useful,
  13. ;;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. ;;;  GNU General Public License for more details.
  16. ;;;
  17. ;;;  You should have received a copy of the GNU General Public License
  18. ;;;  along with this program; if not, write to the Free Software
  19. ;;;  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. ;;;
  21. ;;;
  22. ;;;  Author:    Jochen Wiedmann
  23. ;;;             Am Eisteich 9
  24. ;;;             72555 Metzingen
  25. ;;;             Germany
  26. ;;;
  27. ;;;             Phone: (0049) +7123 / 14881
  28. ;;;             Internet: wiedmann@neckar-alb.de
  29. ;;;
  30. ;;;
  31. ;;;
  32. ;;;  History:   2.0     07-Apr-95       Initial version
  33. ;;;
  34. ;;;             2.2     14-Apr-95       Added CHECK, OFF and SET
  35. ;;;                                     options to GNU:s/User-Startup
  36. ;;;                                     CopyEnvironment procedure does
  37. ;;;                                     no longer depend on the
  38. ;;;                                     existence of GNU:envarc.
  39. ;;;
  40. ;;;             2.3     20-Apr-95       Assign GNUINCLUDE: now optional.
  41. ;;;                                     User may switch between modifying
  42. ;;;                                     specs file and using
  43. ;;;                                     C_INCLUDE_PATH.
  44. ;;;
  45. ;;;             2.4     13-May-95       Fixed bug in the specs file
  46. ;;;                                     modification. Added existence
  47. ;;;                                     checks to Rename020Binaries.
  48. ;;;
  49. ;;;             2.5     20-May-95       Removed GCCSTACK variable (No
  50. ;;;                                     longer needed by gcc 2.7.0)
  51. ;;;
  52. ;;;             2.6     20-Jun-95       Fixed typo; no longer setting
  53. ;;;                                     ENVARC:PAGER by default; fixed
  54. ;;;                                     wrong path removal in
  55. ;;;                                     GNU:s/User-Startup
  56. ;;;
  57. ;;;             2.7     29-Jul-95       Fixed bug in the specs file
  58. ;;;                                     modification: Edit removed
  59. ;;;                                     blanks from the end of a line.
  60. ;;;
  61. ;;;
  62. ;;;             2.8     31-Jul-95       Added GCCSTACK variable again.
  63. ;;;                                     (Sigh!)
  64. ;;;
  65. ;;;             2.9     02-Aug-95       Added "Upgrade" options to
  66. ;;;                                     DeinstallGNU function
  67. ;;;
  68. ;;;             2.10    04-Aug-95       Fixed minor bugs in message
  69. ;;;                                     strings.
  70. ;;;
  71. ;;;             2.11    22-Aug-95       Typos and my bad english :-)
  72. ;;;                                     fixed.
  73. ;;;
  74. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  75.  
  76.  
  77. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  78. ;;;
  79. ;;;  Variable settings
  80. ;;;
  81. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  82. (set installName "gcc")
  83. (set installVersion "2.7.0")
  84. (set installVersionShort "270")
  85. (set minOsVersion 37)
  86.  
  87.  
  88. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  89. ;;;
  90. ;;;  SelectInstallDir procedure
  91. ;;;
  92. ;;;  Allows the user to select an installation directory (full path),
  93. ;;;  which will be stored in the installDir variable.
  94. ;;;
  95. ;;;  Uses:  installDir      old installation directory path
  96. ;;;
  97. ;;;  Sets:  installDir      installation directory path
  98. ;;;
  99. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  100. (set askedInstallDir 0)
  101. (set configSubDir 0)
  102. (procedure SelectInstallDir
  103.  
  104.     (if (NOT askedInstallDir)
  105.     (   (if configSubDir
  106.     (   (set installDir (expandpath (askdir
  107.         (prompt "Please select the directory to configure. ")
  108.         (help "GNU C is installed in one directory, Work:GNU "
  109.               "or something similar. Please select this "
  110.               "directory, so that I can reconfigure it.\n\n"
  111.         )
  112.         (default installDir)
  113.         (newpath)
  114.         )))
  115.  
  116.         (set installDirParent (pathonly installDir))
  117.     )
  118.     (   (set installDirParent (expandpath (askdir
  119.         (prompt "Please select the installation directory. "
  120.             "A drawer GNU will be created."
  121.         )
  122.         (help "GNU C is installed in a directory called `GNU:'. "
  123.               "For example, binaries go into `GNU:bin', link "
  124.               "libraries in `GNU:lib' and so on.\n\n"
  125.               "A typical place for GNU: is something like "
  126.               "`Work:GNU' or something similar. In this "
  127.               "example you should select the directory "
  128.               "`Work:'.\n\n"
  129.               @askdir-help
  130.         )
  131.         (default (pathonly installDir))
  132.         (newpath)
  133.         )))
  134.  
  135.         (set installDir (tackon installDirParent "GNU"))
  136.  
  137.         (message "Installing GNU C in " installDir ".\n\n"
  138.              "Binaries will be in " (tackon installDir "bin")
  139.              ", link libraries in " (tackon installDir "lib")
  140.              ", header files in " (tackon installDir "include")
  141.              "."
  142.         )
  143.     ))
  144.     (set @default-dest installDir)
  145.     (CompleteStep)
  146.  
  147.     (set askedInstallDir 1)
  148.     ))
  149. )
  150.  
  151.  
  152. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  153. ;;;
  154. ;;;  SelectVersion procedure
  155. ;;;
  156. ;;;  Allows the user to select a version to install.
  157. ;;;
  158. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  159. (set askedInstallVersion 0)
  160. (procedure SelectVersion
  161.  
  162.     (if (NOT askedInstallVersion)
  163.     (   (set installVersion (askstring
  164.         (prompt "Enter the version of GNU C to install.")
  165.         (help "Certain files and directories contain the version "
  166.           "of GNU C in the path, thus I need to know them. "
  167.           "Please enter the GNU C version in the form "
  168.           installVersion ".\n\n"
  169.           @askstring-help
  170.         )
  171.         (default installVersion)
  172.     ))
  173.  
  174.     (set installVersionShort (cat
  175.         (substr installVersion 0 1)
  176.         (substr installVersion 2 1)
  177.         (substr installVersion 4 1)
  178.     ))
  179.  
  180.     (set askedInstallVersion 1)
  181.     ))
  182. )
  183.  
  184.  
  185. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  186. ;;;
  187. ;;;  SelectDeinstallDir procedure
  188. ;;;
  189. ;;;  Allows the user to select a directory to be deinstalled.
  190. ;;;
  191. ;;;  Uses: oldInstallDir    directory of recent GNU C installation
  192. ;;;
  193. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  194. (procedure SelectDeinstallDir
  195.  
  196.     (set deinstallDir (askdir
  197.     (prompt "Select the directory where to deinstall GNU C.")
  198.     (help "If your GNU C version is installed in Work:GNU, for "
  199.           "example, select Work:GNU, so that I can remove it.\n\n"
  200.           @askdir-help
  201.     )
  202.     (default oldInstallDir)
  203.     ))
  204.     (CompleteStep)
  205. )
  206.  
  207.  
  208. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  209. ;;;
  210. ;;;  CheckObsoleteDir procedure
  211. ;;;
  212. ;;;  Asks the user if he wants an "obsolete" directory and creates it,
  213. ;;;  if this is the case. The name will be stored in installObsoleteDir
  214. ;;;  in that case, otherwise this variable will receive the value "".
  215. ;;;
  216. ;;;  Uses: installDir   name of installation directory
  217. ;;;
  218. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  219. (set installObsoleteDirChecked 0)
  220. (procedure CheckObsoleteDir
  221.  
  222.     (if (NOT installObsoleteDirChecked)
  223.     (   (set installObsoleteDir (tackon installDir "obsolete"))
  224.     (if (<> (exists installObsoleteDir) 2)
  225.     (   (makedir installObsoleteDir
  226.         (prompt "Creating a directory " installObsoleteDir " to keep "
  227.             "old prefs files and icons."
  228.         )
  229.         (help "Old user-editabe files may be prevented from "
  230.               "deletion by copying them to " installObsoleteDir
  231.               ". You may skip this part, if you don't want this.\n\n"
  232.               @makedir-help
  233.         )
  234.         (confirm 2)
  235.         (infos)
  236.         )
  237.         (if (<> (exists installObsoleteDir) 2)
  238.         (   (set installObsoleteDir "")
  239.         ))
  240.     ))
  241.     (set installObsoleteDirChecked 1)
  242.     ))
  243. )
  244.  
  245.  
  246. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  247. ;;;
  248. ;;;  CheckObsoleteFile procedure
  249. ;;;
  250. ;;;  Uses: checkObsoleteFileName    name of file to be copyied into the
  251. ;;;                                 obsolete directory (relative to
  252. ;;;                                 installDir)
  253. ;;;        installObsoleteDir       name of the "obsolete" directory
  254. ;;;        installDir               name of the installation directory
  255. ;;;
  256. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  257. (procedure CheckObsoleteFile
  258.  
  259.     (if (exists checkObsoleteFileName)
  260.     (   (CheckObsoleteDir)
  261.  
  262.     (if installObsoleteDir
  263.     (   (copyfiles
  264.         (prompt ("Preserving old file %s ..." checkObsoleteFileName))
  265.         (help "The old file " checkObsoleteName " may be preserved "
  266.               "by copying it to " installObsoleteDir ". You may skip "
  267.               "this part, if you don't want this.\n\n"
  268.               @copyfiles-help
  269.         )
  270.         (source checkObsoleteFileName)
  271.         (dest installObsoleteDir)
  272.         (infos)
  273.         (confirm 2)
  274.         (optional "oknodelete" "force" "askuser")
  275.         )
  276.     ))
  277.     ))
  278. )
  279.  
  280.  
  281. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  282. ;;;
  283. ;;;  CheckOsVersion procedure
  284. ;;;
  285. ;;;  Aborts, if OS version is lower than the variable minOsVersion.
  286. ;;;  Sets osVersion variable.
  287. ;;;
  288. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  289. (procedure CheckOsVersion
  290.     (set osVersion (/ (getversion "exec.library" (resident)) 65536))
  291.     (if (< osVersion minOsVersion)
  292.     (   (abort "Sorry, " installName
  293.            " needs Kickstart/Workbench 2.04 or higher.")
  294.     ))
  295. )
  296.  
  297.  
  298. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  299. ;;;
  300. ;;;  ShowCopyrightMessage procedure
  301. ;;;
  302. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  303. (procedure ShowCopyrightMessage
  304.     (message "GNU C:    The GNU Project C and C++ Compiler\n\n"
  305.     "V" installVersion "     © 1995 Free Software Foundation  \n\n"
  306.     "This program is FREE SOFTWARE; you can redistribute it and/or "
  307.     "modify it under the terms of the GNU General Public License as "
  308.     "published by the Free Software Foundation; either version 2 "
  309.     "or any later version.\n\n"
  310.     "This program is distributed in the hope that it will be useful, "
  311.     "but WITHOUT ANY WARRANTY! See the GNU General Public License "
  312.     "(in the file COPYING) for details."
  313.     )
  314. )
  315.  
  316.  
  317. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  318. ;;;
  319. ;;;  CheckGNUDir procedure
  320. ;;;
  321. ;;;  Checks, if GNU: or GCC: assign exists; stores value in
  322. ;;;  installDir sets boolean variable oldInstallationSeen.
  323. ;;;
  324. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  325. (procedure CheckGNUDir
  326.  
  327.     (set installDir (getassign "GNU" "va"))
  328.     (if (= installDir "")
  329.     (   (set installDir (getassign "GCC" "va"))
  330.     ))
  331.  
  332.     (if (<> installDir "")
  333.     (   (set installDir (expandpath installDir))
  334.     (set oldInstallationSeen 1)
  335.     (set oldInstallDir installDir)
  336.     (transcript "Existing GNU C installation in " installDir
  337.             " detected.")
  338.     )
  339.     (   (set installDir "SYS:GNU")
  340.     (set oldInstallationSeen 0)
  341.     (transcript "Performing initial GNU C installation.")
  342.     ))
  343.     (set @default-dest installDir)
  344. )
  345.  
  346.  
  347. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  348. ;;;
  349. ;;;  RenameFile procedure
  350. ;;;
  351. ;;;  Renames a file by creating the directory of the new location,
  352. ;;;  if this is needed.
  353. ;;;
  354. ;;;  Uses: oldFileName
  355. ;;;        newFileName
  356. ;;;
  357. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  358. (procedure RenameFile
  359.  
  360.     (if (exists oldFileName)
  361.     (   (if (NOT (exists (pathonly newFileName)))
  362.     (   (makedir (pathonly newFileName))
  363.     ))
  364.     (rename oldFileName newFileName)
  365.     ))
  366. )
  367.  
  368.  
  369. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  370. ;;;
  371. ;;;  DeinstallGNU procedure
  372. ;;;
  373. ;;;  Deletes GNU:lib/gcc-lib or GNU: (if the GNU: path was changed by
  374. ;;;  the user)
  375. ;;;
  376. ;;;  Uses: deinstallDir     Directory where to deinstall GNU C.
  377. ;;;
  378. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  379. (procedure DeinstallGNU
  380.  
  381.     (set deinstallKind (askchoice
  382.     (prompt "Which kind of deinstallation do you want?")
  383.     (help "Selecting \"Complete removal\" means removing "
  384.           "the complete directory " deinstallDir ". This is "
  385.           "usually selected, if you want to remove GNU C or "
  386.           "want to install a new version in another directory.\n\n"
  387.           "If you just want to replace the existing version with "
  388.           "a new one in the same directory, it should be "
  389.           "sufficient to select \"Partial removal\": This "
  390.           "will only remove " (tackon deinstallDir "lib/gcc-lib")
  391.           ", as other files will be overwritten when installing "
  392.           "the new version.\n\n"
  393.           "\"Preserve old version\" will just rename gcc and gccv "
  394.           "to gcc-2.6.3 (for example), so that you can have "
  395.           "different versions of gcc installed at the same "
  396.           "time.\n\n"
  397.           @askchoice-help
  398.     )
  399.     (choices "Complete removal"
  400.          "Partial removal"
  401.          "Preserve old version"
  402.     )
  403.     (default 0)
  404.     ))
  405.     (if (AND (<> deinstallKind 2)
  406.          (patmatch deinstallDir oldInstallDir))
  407.     (   (startup "GNU stuff"
  408.         (prompt "Removing GNU C from s:User-Startup.")
  409.         (help "Your version of GNU C in " deinstallDir
  410.           "will be no longer usable. If there are any lines in "
  411.           "your S:User-Startup concerning GNU C, they should "
  412.           "probably be removed.\n\n"
  413.           @startup-help
  414.         )
  415.     )
  416.     ))
  417.     (CompleteStep)
  418.  
  419.     (select deinstallKind
  420.     (   (set deleteFileName deinstallDir)
  421.     (DeleteFile)
  422.     (if (patmatch deinstallDir oldInstallDir)
  423.     (   (message "I was not able to remove the directory "
  424.              deinstallDir " and some of its subdirectories, "
  425.              "as there are still assigns pointing to them.\n\n"
  426.              "You should remove them manually later.\n"
  427.         )
  428.     ))
  429.     )
  430.     (   (set n 0)
  431.     (while (set file (select n "lib/gcc-lib"
  432.                    "lib/libgcc.a"
  433.                    "lib/libb/libgcc.a"
  434.                    "lib/libm020/libgcc.a"
  435.                    "lib/libb/libm020/libgcc.a"
  436.                    ""
  437.            ))
  438.     (   (set deleteFileName (tackon deinstallDir file))
  439.         (DeleteFile)
  440.         (set n (+ n 1))
  441.     ))
  442.     )
  443.     (   (set deinstallBinary (tackon deinstallDir "bin/gcc"))
  444.     (set deinstallBinaryOk 0)
  445.     (if (exists deinstallBinary)
  446.     (   (run (cat "setenv INSTALLED_GCC_BINARY_VERSION `"
  447.               deinstallBinary " -v`"
  448.         ))
  449.         (set deinstallBinaryVersion
  450.          (getenv "INSTALLED_GCC_BINARY_VERSION"))
  451.         (set n 0)
  452.         (while (AND (< n (strlen deinstallBinaryVersion))
  453.             (<> (substr deinstallBinaryVersion n 11) "lib/gcc-lib"))
  454.         (   (set n (+ n 1))
  455.         ))
  456.         (if (< n (strlen deinstallBinaryVersion))
  457.         (   (set deinstallBinaryVersion
  458.              (substr deinstallBinaryVersion n))
  459.         (set n 0)
  460.         (while (AND (< n (strlen deinstallBinaryVersion))
  461.                 (<> (substr deinstallBinaryVersion n 6) "/specs"))
  462.         (   (set n (+ n 1))
  463.         ))
  464.         (if (< n (strlen deinstallBinaryVersion))
  465.         (   (set deinstallBinaryVersion
  466.              (substr deinstallBinaryVersion 0 n))
  467.             (set deinstallVersion (fileonly deinstallBinaryVersion))
  468.             (set n 0)
  469.             (set oldFile 1)
  470.             (while (set file (select n "bin/gcc" (cat "bin/gcc-" deinstallVersion)
  471.                            "bin/gccv" (cat "bin/gccv-" deinstallVersion)
  472.                            "lib/libgcc.a" (cat deinstallBinaryVersion "/libgcc.a")
  473.                            "lib/libb/libgcc.a" (cat deinstallBinaryVersion "/libb/libgcc.a")
  474.                            "lib/libm020/libgcc.a" (cat deinstallBinaryVersion "/libm020/libgcc.a")
  475.                            "lib/libb/libm020/libgcc.a" (cat deinstallBinaryVersion "/libb/libm020/libgcc.a")
  476.                            ""
  477.                ))
  478.             (   (if oldFile
  479.             (   (set oldFileName (tackon deinstallDir file))
  480.             )
  481.             (   (set newFileName (tackon deinstallDir file))
  482.                 (RenameFile)
  483.             ))
  484.             (set oldFile (NOT oldFile))
  485.             (set n (+ n 1))
  486.             ))
  487.             (set deinstallBinaryOk 1)
  488.         ))
  489.         ))
  490.  
  491.     ))
  492.     (if (NOT deinstallBinaryOk)
  493.     (   (message "Cannot find GNU C in " deinstallDir ". A "
  494.              "possible reason is a missing or wrong GNU: "
  495.              "assign.")
  496.     ))
  497.     ))
  498.     (CompleteStep)
  499. )
  500.  
  501.  
  502. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  503. ;;;
  504. ;;;  DeleteFile procedure
  505. ;;;
  506. ;;;  Deletes a file
  507. ;;;
  508. ;;;  Uses: deleteFileName   file to delete
  509. ;;;
  510. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  511. (procedure DeleteFile
  512.  
  513.     (select (exists deleteFileName)
  514.     (   (set deleteFileName deleteFileName)
  515.     )
  516.     (   (delete deleteFileName
  517.         (prompt "Deleting " deleteFileName "...")
  518.         (optional "force" "askuser")
  519.     )
  520.     )
  521.     (   (working "Deleting directory " deleteFileName)
  522.     (run (cat "C:Delete \"" deleteFileName "\" ALL QUIET"))
  523.     ))
  524. )
  525.  
  526.  
  527. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  528. ;;;
  529. ;;;  SelectLHAProgram procedure
  530. ;;;
  531. ;;;  Lets the user select the LHA binary; sets the variable lhaProgram.
  532. ;;;
  533. ;;;  Sets: lhaProgram   path of LhA binary
  534. ;;;
  535. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  536. (procedure SelectLHAProgram
  537.  
  538.     (set l 1)
  539.     (while l
  540.     (   (set lhaProgram (askfile
  541.         (prompt "Please select your LhA program.")
  542.         (help "Unfortunately the Installer program ignores "
  543.           "your path settings. Thus I need to know the "
  544.           "complete path of your LhA program.\n\n"
  545.           @askfile-help
  546.         )
  547.         (default "LhA")
  548.     ))
  549.     (if (exists lhaProgram)
  550.     (   (set l 0)
  551.     ))
  552.     ))
  553.     (CompleteStep)
  554. )
  555.  
  556.  
  557. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  558. ;;;
  559. ;;;  SelectPackages procedure
  560. ;;;
  561. ;;;  Allows the user to select the archives that should be unarchived.
  562. ;;;  Result is stored in the gnuPackagesChoice variable.
  563. ;;;
  564. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  565. (procedure SelectPackages
  566.  
  567.     (set gnuPackagesChoice (askoptions
  568.     (prompt "Which parts of gcc should be installed?")
  569.     (choices "Base distribution"
  570.          "Includes & Libraries"
  571.          "C"
  572.          "C++"
  573.          "Objective-C"
  574.          "Additional Utilities"
  575.          "On-line Documentation"
  576.          "Utilities On-line Documentation"
  577.          "Source Diffs"
  578.          "Documentation sources")
  579.     (default 71)
  580.     (help "gcc is distributed in different LhA archives. "
  581.           "I will unarchive those parts to " installDir
  582.           " that you select.\n\n"
  583.           "A minimal installation requires base distribution, "
  584.           "Includes & Libraries and the C distribution. This will take "
  585.           "about 7.5 MB of harddisk space. However, I recommend at least "
  586.           "adding the on-line documentation, so you get a minimum of "
  587.           "10 MB.\n\n"
  588.           @askoptions-help
  589.     )
  590.     ))
  591.     (CompleteStep)
  592. )
  593.  
  594.  
  595. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  596. ;;;
  597. ;;;  Ask020Binaries procedure
  598. ;;;
  599. ;;;  Asks the user, if he wants the 68020 binaries. Result stored in
  600. ;;;  install020 variable.
  601. ;;;
  602. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  603. (set asked020Binaries 0)
  604. (procedure Ask020Binaries
  605.  
  606.     (if (NOT asked020Binaries)
  607.     (   (set install020 "")
  608.     (if (NOT (OR (= (database "cpu") "68000")
  609.              (= (database "cpu") "68010")
  610.         ))
  611.     (   (if (askbool
  612.             (prompt "Do you like to have the 68020 binaries "
  613.                 "installed?\n\n"
  614.                 "Of course you need to have the 68020 binaries "
  615.                 "(packages "
  616.                 "gcc" installVersionShort "-c-020.lha, "
  617.                 "gcc" installVersionShort "-c++-020.lha and "
  618.                 "gcc" installVersionShort "-objc020.lha, "
  619.                 "respectively) available.\n\n"
  620.             )
  621.             (help "The GNU C distribution offers two different "
  622.               "binary versions. If your machine's CPU is a "
  623.               "68020 or above, then you should install the "
  624.               "68020 binaries and select \"Yes\". This won't "
  625.               "affect the binaries created by you. It only "
  626.               "increases the compilers speed.\n\n"
  627.               "Otherwise you should select \"No\".\n\n"
  628.               @askbool-help
  629.             )
  630.             (default 1)
  631.         )
  632.         (   (set install020 "-020")
  633.         ))
  634.     ))
  635.     (CompleteStep)
  636.  
  637.     (set asked020Binaries 1)
  638.     ))
  639. )
  640.  
  641.  
  642. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  643. ;;;
  644. ;;;  UnpackArchive procedure
  645. ;;;
  646. ;;;  Unpacks one LhA file.
  647. ;;;
  648. ;;;  Uses: installArchiveName   name of archive file
  649. ;;;        lhaCommand           command to execute for dearchiving
  650. ;;;
  651. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  652. (set defaultArchivePath "")
  653. (procedure UnPackArchive
  654.  
  655.  
  656.     (set l 1)
  657.     (while l
  658.     (   (set installArchive (askfile
  659.         (prompt "Please select the archive file "
  660.              installArchiveName " for unpacking."
  661.         )
  662.         (help "Please select the archive file " installArchiveName ". "
  663.           "I will unpack this archive to " installDir ".\n\n"
  664.           @askfile-help
  665.         )
  666.         (default (tackon defaultArchivePath installArchiveName))
  667.     ))
  668.     (set defaultArchivePath (pathonly installArchive))
  669.     (if (exists installArchive)
  670.     (   (set l 0)
  671.         (if (run (lhaCommand installArchive)
  672.             (prompt ("\n\nUnpacking %s ..." installArchive))
  673.         )
  674.         (   (abort "\n\n" (lhaCommand installArchive)
  675.                "\n\nshowed an error."
  676.         )
  677.         ))
  678.     )
  679.     (   (message "File " installArchive " does not exist.")
  680.         (set installArchive "")
  681.     ))
  682.     ))
  683. )
  684.  
  685.  
  686. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  687. ;;;
  688. ;;;  CopyEnvironment procedure
  689. ;;;
  690. ;;;  Creates environment variables
  691. ;;;
  692. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  693. (procedure CopyEnvironment
  694.  
  695.     (SelectOSHeadersDir)
  696.  
  697.     (set varsToCreatePrompt "Installing environment variables in \"ENVARC:\"")
  698.     (set varsToCreateHelp
  699.     (cat "Some environment variables are required or encouraged.\n\n"
  700.          "GCCSTACK ensures that gcc won't run out of stack. "
  701.          "GCCPRIORITY is the priority of gcc's child processes.\n"
  702.          "LESSCHARSET, PAGER and TERM usually aren't needed, "
  703.          "except, if you are using \"less\" or similar programs.\n\n"
  704.     ))
  705.  
  706.     (if (AND (<> osHeadersDir "")
  707.          (= osHeadersInstallStyle 1))
  708.  
  709.     (   (if useGNUINCLUDE
  710.     (   (set includePath "/GNUINCLUDE")
  711.     )
  712.     (   (set includePath osHeadersDir)
  713.     ))
  714.  
  715.     (set varsToCreate (askoptions
  716.         (prompt varsToCreatePrompt)
  717.         (help varsToCreateHelp
  718.           "C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJC_INCLUDE_PATH "
  719.           "and OBJCPLUS_INCLUDEPATH tell gcc, where to find the "
  720.           "OS headers.\n\n"
  721.           @askoptions-help
  722.         )
  723.         (choices "GCCPRIORITY"
  724.              "GCCSTACK"
  725.              "LESSCHARSET"
  726.              "PAGER"
  727.              "TERM"
  728.              "C_INCLUDE_PATH"
  729.              "CPLUS_INCLUDE_PATH"
  730.              "OBJC_INCLUDE_PATH"
  731.              "OBJCPLUS_INCLUDE_PATH"
  732.         )
  733.         (default 503)
  734.     ))
  735.     )
  736.     (   (set varsToCreate (askoptions
  737.         (prompt varsToCreatePrompt)
  738.         (help varsToCreateHelp @askoptions-help)
  739.         (choices "GCCPRIORITY"
  740.              "GCCSTACK"
  741.              "LESSCHARSET"
  742.              "PAGER"
  743.              "TERM"
  744.         )
  745.         (default 23)
  746.     ))
  747.     ))
  748.  
  749.  
  750.     (set n 0)
  751.     (set bit 1)
  752.     (while (set word (select n "GCCPRIORITY"            "-1"
  753.                    "GCCSTACK"               "350000"
  754.                    "LESSCHARSET"            "latin"
  755.                    "PAGER"                  "/usr/bin/more"
  756.                    "TERM"                   "amiga"
  757.                    "C_INCLUDE_PATH"         includePath
  758.                    "CPLUS_INCLUDE_PATH"     includePath
  759.                    "OBJC_INCLUDE_PATH"      includePath
  760.                    "OBJCPLUS_INCLUDE_PATH"  includePath
  761.                    ""
  762.        ))
  763.     (   (if (BITAND n 1)
  764.     (   (if (BITAND bit varsToCreate)
  765.         (   (set checkObsoleteFileName (tackon "ENVARC:" varName))
  766.         (CheckObsoleteFile)
  767.         (textfile
  768.             (prompt "Creating environment variable " varName)
  769.             (help @textfile-help)
  770.             (dest (tackon "ENVARC:" varName))
  771.             (append word)
  772.         )
  773.         ))
  774.         (set bit (shiftleft bit 1))
  775.     )
  776.     (   (set varName word)
  777.     ))
  778.     (set n (+ n 1))
  779.     ))
  780.  
  781. ;    (if (exists "ENVARC:GCCSTACK")
  782. ;    (   (if (askbool
  783. ;                (prompt "The environment variable GCCSTACK is no longer "
  784. ;                        "needed as of gcc 2.7.0.\n\n"
  785. ;                        "Do you want to remove it?\n"
  786. ;                )
  787. ;                (help "Recent versions of gcc (2.6.0-2.6.3) needed an "
  788. ;                      "environment variable GCCSTACK to ensure sufficient "
  789. ;                      "stack. This variable is no longer needed, as gcc "
  790. ;                      "extends its stack dynamically now.\n\n"
  791. ;                      "Select \"Yes\", if you want to remove this "
  792. ;                      "obsolete variable or \"No\", if you want to "
  793. ;                      "keep it for recent versions."
  794. ;                )
  795. ;                (default 1)
  796. ;            )
  797. ;        (   (set deleteFileName "ENVARC:GCCSTACK")
  798. ;            (DeleteFile)
  799. ;        ))
  800. ;    ))
  801.  
  802.     (CompleteStep)
  803. )
  804.  
  805.  
  806. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  807. ;;;
  808. ;;;  ModifyUserStartup procedure
  809. ;;;
  810. ;;;  Modifies s:User-Startup and creates GNU:s/User-Startup
  811. ;;;
  812. ;;;  Uses: installDir   installation directory
  813. ;;;        osHeadersDir path of OS headers
  814. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  815. (procedure ModifyUserStartup
  816.  
  817.     (SelectOSHeadersDir)
  818.  
  819.     (startup "GNU stuff"
  820.     (command "Assign GNU: " installDir "\n")
  821.     (command "Execute GNU:s/User-Startup\n")
  822.     (prompt "The following lines should be added to your s:User-Startup:\n\n"
  823.         "Assign GNU: " installDir "\n"
  824.         "Execute GNU:s/User-Startup\n\n"
  825.         "Shall I do this now?"
  826.     )
  827.     (help "gcc needs a special environment, some assigns for example. "
  828.           "The easiest way to get this environment is to meodify your "
  829.           "User-Startup file, so that it is created automatically when "
  830.           "your machine boots.\n\n"
  831.           @startup-help
  832.     )
  833.     )
  834.  
  835.     (if (AND (<> osHeadersDir "")
  836.          (= osHeadersInstallStyle 0))
  837.     (   (SelectVersion)
  838.     (Ask020Binaries)
  839.     (if (<> install020 "")
  840.     (   (set specsFile (tackon installDir
  841.                    (cat "lib/gcc-lib/mc68020-cbm-amigados/"
  842.                     installVersion "/specs"))
  843.         )
  844.     )
  845.     (   (set specsFile (tackon installDir
  846.                    (cat "lib/gcc-lib/mc68000-cbm-amigados/"
  847.                     installVersion "/specs"))
  848.         )
  849.     ))
  850.  
  851.     (if (AND (exists "C:Edit")
  852.          (exists specsFile))
  853.     (   (if useGNUINCLUDE
  854.         (   (set specsString "-IGNUINCLUDE:")
  855.         )
  856.         (   (set specsString (cat "-I" osHeadersDir))
  857.         ))
  858.  
  859.         (set checkObsoleteFileName specsFile)
  860.         (CheckObsoleteFile)
  861.         (textfile
  862.         (prompt "Creating batch file for C:Edit.")
  863.         (help "A batchfile with commands for C:Edit must be "
  864.               "created."
  865.               @textfile-help
  866.         )
  867.         (dest "t:specsFileEdit")
  868.         (append "TR+\n"
  869.             "F B/*cpp:/\n"
  870.             "N\n"
  871.             "DTB /%{m68881/\n"
  872.             "B,%{m68881,%{!nostdinc:" specsString " },\n"
  873.             "Q\n"
  874.         )
  875.         )
  876.         (run (cat "C:Edit " specsFile " WITH t:specsFileEdit OPT W4096"))
  877.         (set deleteFileName "t:specsFileEdit")
  878.         (DeleteFile)
  879.     )
  880.     (   (message
  881.         "C:Edit or specs file " specsFile
  882.         "not found. You must edit the specs file "
  883.         "manually and add \"" specsString "\" to "
  884.         "the cpp entry. The line should look as follows:\n\n"
  885.         "    *cpp:\n"
  886.         "    %{!nostdinc:" specsString " }%{m68881 ...\n\n"
  887.         "Otherwise you need to add \"" specsString "\" to your "
  888.         "command line each time you are using Commodore "
  889.         "headers."
  890.         )
  891.     ))
  892.     )
  893.     (   (set osHeadersString "")
  894.     ))
  895.  
  896.     (if (<> (exists (tackon installDir "s")) 2)
  897.     (   (makedir (tackon installDir "s")
  898.         (prompt "Creating GNU:s directory.")
  899.         (help "A directory GNU:s will be created which contains "
  900.           "the files that are executed at startup time."
  901.           @makedir-help
  902.         )
  903.     )
  904.     ))
  905.  
  906.     (set checkObsoleteFileName (tackon installDir "s/User-Startup"))
  907.     (CheckObsoleteFile)
  908.     (if useGNUINCLUDE
  909.     (   (set installGNUINCLUDE
  910.         (cat "            Assign GNUINCLUDE: \"" osHeadersDir "\"\n")
  911.     )
  912.     (set deinstallGNUINCLUDE
  913.         (cat "        Assign GNUINCLUDE: REMOVE >nil:\n")
  914.     )
  915.     )
  916.     (   (set installGNUINCLUDE "")
  917.     (set deinstallGNUINCLUDE "")
  918.     ))
  919.  
  920.     (textfile
  921.     (prompt "Creating the GNU startup file GNU:s/user-startup.")
  922.     (help "The file GNU:s/user-startup must be executed before "
  923.           "using gcc, usually from s:User-Startup."
  924.     )
  925.     (dest (tackon installDir "s/User-Startup"))
  926.     (append ".key ON/S,OFF/S,SET/S,CHECK/S\n"
  927.         ".bra {\n"
  928.         ".ket }\n"
  929.         "\n"
  930.         ";  GNU User-Startup\n"
  931.         ";\n"
  932.         ";      User-Startup ON     for installing GNU assigns. (default)\n"
  933.         ";      User-Startup OFF    for removing GNU assigns.\n"
  934.         ";      User-Startup CHECK  for checking, if assigns exist.\n"
  935.         ";      User-Startup SET    for setting paths only.\n"
  936.         "\n"
  937.         "IF \"{OFF}\" EQ \"\"\n"
  938.         "    IF \"{CHECK}\" EQ \"\"\n"
  939.         "        IF \"{SET}\" EQ \"\"\n"
  940.         "            Assign GNU: EXISTS >nil:\n"
  941.         "            IF WARN\n"
  942.         "                Assign GNU: \"" installDir "\"\n"
  943.         "            ENDIF\n"
  944.         "            Assign BIN:        GNU:bin\n"
  945.         "            Assign ETC:        GNU:etc\n"
  946.         "            Assign DEV:        GNU:dev\n"
  947.         "            Assign TMP:        t:\n"
  948.         "            Assign LIBS:       GNU:Libs ADD\n"
  949.         "            Assign LOCAL:      GNU:\n"
  950.         installGNUINCLUDE
  951.         "            Assign L:          GNU:ixpipe ADD\n"
  952.         "        ENDIF\n"
  953.         "        Set ESHELL \"GNU:bin/sh\"\n"
  954.         "        Path GNU:bin add\n"
  955.         "    ELSE\n"
  956.         "        Assign GNU: EXISTS >nil:\n"
  957.         "        IF WARN\n"
  958.         "            Echo \"Assign GNU: doesn't exist.\"\n"
  959.         "            QUIT 5\n"
  960.         "        ELSE\n"
  961.         "            Echo \"Assign GNU: exists.\"\n"
  962.         "        ENDIF\n"
  963.         "    ENDIF\n"
  964.         "ELSE\n"
  965.         "    Assign GNU: EXISTS >nil:\n"
  966.         "    IF NOT WARN\n"
  967.         "        Path GNU:bin REMOVE >nil:\n"
  968.         "        UnSet ESHELL\n"
  969.         "        Assign L: GNU:ixpipe REMOVE >nil:\n"
  970.         deinstallGNUINCLUDE
  971.         "        Assign LOCAL: REMOVE >nil:\n"
  972.         "        Assign LIBS: GNU:Libs REMOVE\n"
  973.         "        Assign TMP: REMOVE\n"
  974.         "        Assign DEV: REMOVE\n"
  975.         "        Assign ETC: REMOVE\n"
  976.         "        Assign BIN: REMOVE\n"
  977.         "        Assign GNU: REMOVE\n"
  978.         "    ENDIF\n"
  979.         "ENDIF\n"
  980.     )
  981.     )
  982.     (protect (tackon installDir "s/User-Startup") "+s")
  983.  
  984.     (CompleteStep)
  985. )
  986.  
  987.  
  988. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  989. ;;;
  990. ;;;  CreateLink procedure
  991. ;;;
  992. ;;;  Creates one link
  993. ;;;
  994. ;;;  Uses: useLinks         1, if "C:MakeLink" should be used, 0 for copy
  995. ;;;        linkDestFile     file to be created (absolute path)
  996. ;;;        linkSourceFile   file to be copied (absolute path)
  997. ;;;
  998. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  999. (procedure CreateLink
  1000.  
  1001.     (if (exists linkSourceFile)
  1002.     (   (if (exists linkDestFile)
  1003.     (   (set deleteFileName linkDestFile)
  1004.         (DeleteFile)
  1005.     ))
  1006.     (if useLinks
  1007.     (   (run (cat "C:MakeLink \"" linkDestFile "\" \"" linkSourceFile))
  1008.     )
  1009.     (   (copyfiles
  1010.         (prompt "Faking link from " linkSourceFile " to "
  1011.             linkDestFile "."
  1012.         )
  1013.         (source linkSourceFile)
  1014.         (dest (pathonly linkDestFile))
  1015.         (newname (fileonly linkDestFile))
  1016.         (optional "askuser" "force")
  1017.         )
  1018.     ))
  1019.     ))
  1020. )
  1021.  
  1022.  
  1023. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1024. ;;;
  1025. ;;;  CreateNeededLinks procedure
  1026. ;;;
  1027. ;;;  Creates needed links.
  1028. ;;;
  1029. ;;;  Uses: installDir
  1030. ;;;
  1031. ;;;  Sets: useLinks
  1032. ;;;
  1033. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1034. (procedure CreateNeededLinks
  1035.  
  1036.     (set useLinks (askchoice
  1037.     (prompt "\n\nSome files may be installed either as links "
  1038.         "or copied. What do you prefer?"
  1039.     )
  1040.     (help "\n\nAmigaDOS is still having problems with links. "
  1041.           "Thus you might prefer to copy files."
  1042.           "\n\nOn the other hand links save disk space. "
  1043.           "(Not very much.)"
  1044.           @askbool-help
  1045.     )
  1046.     (choices "Copy them anyway"
  1047.          "Use Links"
  1048.     )
  1049.     (default 0)
  1050.     ))
  1051.  
  1052.     (set n 0)
  1053.     (set left 0)
  1054.     (while (set file (select n "bin/gzip"           "bin/gunzip"
  1055.                    "bin/gzip"           "bin/zcat"
  1056.                    "bin/zdiff"          "bin/zcmp"
  1057.                    "bin/grep"           "bin/fgrep"
  1058.                    "bin/grep"           "bin/egrep"
  1059.                    "bin/dir"            "bin/d"
  1060.                    "bin/dir"            "bin/v"
  1061.                    "bin/dir"            "bin/vdir"
  1062.                    "bin/flex"           "bin/flex++"
  1063.                    "bin/install"        "bin/ginstall"
  1064.                    "bin/sh"             "bin/ksh"
  1065.                    "bin/awk"            "bin/gawk"
  1066.                    "bin/test"           "bin/["
  1067.                    "man/man1/gzip.1"    "man/man1/gunzip.1"
  1068.                    "man/man1/gzip.1"    "man/man1/zcat.1"
  1069.                    "man/man1/zdiff.1"   "man/man1/zcmp.1"
  1070.                    ""
  1071.        ))
  1072.     (   (if left
  1073.     (   (set linkDestFile (tackon installDir file))
  1074.         (CreateLink)
  1075.     )
  1076.     (   (set linkSourceFile (tackon installDir file))
  1077.     ))
  1078.     (set left (NOT left))
  1079.     (set n (+ n 1))
  1080.     ))
  1081.  
  1082.     (CompleteStep)
  1083. )
  1084.  
  1085.  
  1086. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1087. ;;;
  1088. ;;;  Rename020Binaries procedure
  1089. ;;;
  1090. ;;;  Renames gcc-020, g++-020, ... to gcc, g++, ..., respectively
  1091. ;;;
  1092. ;;;  Uses: install020   set, if 68020 binaries to be installed
  1093. ;;;
  1094. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1095. (procedure Rename020Binaries
  1096.  
  1097.     (Ask020Binaries)
  1098.  
  1099.     (if (<> install020 "")
  1100.     (   (if (askbool
  1101.         (prompt "\n\nDo you want me to rename the binaries "
  1102.             "gcc-020, g++-020, ... to gcc, g++, ..., "
  1103.             "respectively?"
  1104.         )
  1105.         (help "Some users have both 68000 and 68020 binaries "
  1106.               "available. This requires that certain binaries "
  1107.               "like gcc, g++ ... have the ending \"-020\" "
  1108.               "appended to their name.\n\n"
  1109.               "Most others won't prefer to use the names gcc, "
  1110.               "g++, ..., however. If you do, select \"Yes\", "
  1111.               "and I will rename them, otherwise select "
  1112.               "\"No\".\n\n "
  1113.               @askbool-help
  1114.         )
  1115.         (default 1)
  1116.         )
  1117.     (   (set n 0)
  1118.         (while (set file (select n "bin/gcc"
  1119.                        "bin/c++"
  1120.                        "bin/g++"
  1121.                        "bin/gccv"
  1122.                        "bin/protoize"
  1123.                        "bin/unprotoize"
  1124.                        ""
  1125.            ))
  1126.         (   (set newFileName (tackon installDir file))
  1127.         (set oldFileName (cat newFileName "-020"))
  1128.         (if (exists oldFileName)
  1129.         (   (set deleteFileName newFileName)
  1130.             (DeleteFile)
  1131.             (rename oldFileName newFileName)
  1132.         ))
  1133.         (set n (+ n 1))
  1134.         ))
  1135.     ))
  1136.     ))
  1137.     (CompleteStep)
  1138. )
  1139.  
  1140.  
  1141. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1142. ;;;
  1143. ;;;  SelectOSHeadersDir procedure
  1144. ;;;
  1145. ;;;  Allows the user to select a directory with OS header files.
  1146. ;;;
  1147. ;;;  Sets: osHeadersDir     path to the directory with OS headers.
  1148. ;;;
  1149. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1150. (set osHeadersDirSelected 0)
  1151. (procedure SelectOSHeadersDir
  1152.  
  1153.     (if (NOT osHeadersDirSelected)
  1154.     (   (set osHeadersDir "")
  1155.     (set osHeadersDirDefault (getassign "GNUINCLUDE" "a"))
  1156.     (set useGNUINCLUDE 0)
  1157.     (set done 0)
  1158.     (while (NOT done)
  1159.     (   (if (askbool
  1160.         (prompt "Do you have the Commodore OS headers installed?")
  1161.         (help "Using the Commodore OS headers may be simplified "
  1162.               "by creating an assign \"GNUINCLUDE:\". Select "
  1163.               "\"Yes\", if you want me to create this assign, "
  1164.               "\"No\" otherwise.\n\n"
  1165.               @askbool-help
  1166.         ))
  1167.         (   (set osHeadersDir (askfile
  1168.             (prompt "Please select the directory with the "
  1169.                 "Commodore OS headers."
  1170.             )
  1171.             (help "Using the Commodore OS headers may be simplified "
  1172.               "by creating an assign \"GNUINCLUDE:\", which "
  1173.               "will lead to the directory with the Commodore "
  1174.               "OS headers. Please select this directory, so that "
  1175.               "I can create this assign.\n\n"
  1176.               @askfile-help
  1177.             )
  1178.             (default osHeadersDirDefault)
  1179.         ))
  1180.         (if (exists (tackon osHeadersDir "exec/types.h"))
  1181.         (   (set done 1)
  1182.         )
  1183.         (   (message "The directory " osHeadersDir " doesn't "
  1184.                  "contain the Commodore OS headers: Cannot "
  1185.                  "find "
  1186.                  (tackon osHeadersDir "exec/types.h")
  1187.             )
  1188.             (set osHeadersDirDefault osHeadersDir)
  1189.             (set osHeadersDir "")
  1190.         ))
  1191.         )
  1192.         (   (message "You won't be able to write real Amiga applications "
  1193.              "without the Commodore OS headers.\n\n"
  1194.              "You can get them, for example, on the Fish CD's or "
  1195.              "buy them (including the Commodore AutoDocs). Please "
  1196.              "read the Amiga FAQ for details."
  1197.         )
  1198.         (set done 1)
  1199.         ))
  1200.     ))
  1201.  
  1202.     (if (<> osHeadersDir "")
  1203.     (   (set osHeadersInstallStyle (askchoice
  1204.         (prompt "How should I install the OS headers?")
  1205.         (choices "Modify specs file"
  1206.              "Create environment variables"
  1207.              "None of the above"
  1208.         )
  1209.         (help
  1210.         "The OS headers can be installed in different ways.\n\n"
  1211.               "The simplest and safest is to copy them to "
  1212.               (tackon installDir "os-include") ".\n\n"
  1213.               "Another possibility would be to setup certain "
  1214.               "environment variables, so that gcc will always "
  1215.               "look into " osHeadersDir " when searching header "
  1216.               "files.\n\n"
  1217.               "The same result is accomplished by modifying the "
  1218.               "so-called specs file. This is the recommended "
  1219.               "method, although it is less visible for the user.\n\n"
  1220.               @askchoice-help
  1221.         )
  1222.         (default 0)
  1223.         ))
  1224.  
  1225.         (if (< osHeadersInstallStyle 2)
  1226.         (   (if (askbool
  1227.             (prompt "Do you want to create a \"GNUINCLUDE\" assign?")
  1228.             (help "Many people like to have an assign "
  1229.                   "\"GNUINCLUDE:\" with the directories where gcc "
  1230.                   "should always look for header files. Select \"yes\","
  1231.                   "if you do.\n\n"
  1232.                   "Others don't want to have much assigns and prefer "
  1233.                   "to use the name " osHeadersDir " immediately.\n\n"
  1234.                   @askbool-help
  1235.             )
  1236.             (default 0)
  1237.             )
  1238.         (   (set useGNUINCLUDE 1)
  1239.         ))
  1240.  
  1241.         )
  1242.         (   (message "You can still use the OS headers, either by "
  1243.              "adding -I" osHeadersDir " to your gcc command "
  1244.              "line or by copying them to "
  1245.              (tackon installDir "os-include") ".\n\n"
  1246.              "Be sure that you don't override gcc header "
  1247.              "files in the latter case, especially the "
  1248.              "proto directory might be overwritten."
  1249.         )
  1250.         ))
  1251.     ))
  1252.     (CompleteStep)
  1253.  
  1254.     (set osHeadersDirSelected 1)
  1255.     ))
  1256. )
  1257.  
  1258.  
  1259. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1260. ;;;
  1261. ;;;  CompleteStep procedure
  1262. ;;;
  1263. ;;;  Shows how much of the work is completed.
  1264. ;;;
  1265. ;;;  Uses: completeLevel        Percent of work already done
  1266. ;;;        completeIncrement    Percent to add for this step
  1267. ;;;
  1268. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1269. (procedure CompleteStep
  1270.  
  1271.     (set completeLevel (+ completeLevel completeIncrement))
  1272.     (complete completeLevel)
  1273. )
  1274.  
  1275.  
  1276. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1277. ;;;
  1278. ;;;  UnpackArchives procedure
  1279. ;;;
  1280. ;;;  Allows the user to select and unpack LhA archives.
  1281. ;;;
  1282. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1283. (procedure UnpackArchives
  1284.  
  1285.     (SelectVersion)
  1286.     (Ask020Binaries)
  1287.  
  1288.     (if (askbool
  1289.         (prompt "\n\nShould I unpack the archives for you?")
  1290.         (help "GNU C is distributed in different archives. These "
  1291.           "must be unpacked using the program LhA. We'll do "
  1292.           "this now in case you didn't already."
  1293.         )
  1294.         (default 1)
  1295.     )
  1296.     (   (SelectLHAProgram)
  1297.  
  1298.     (SelectPackages)
  1299.     (CompleteStep)
  1300.  
  1301.     (set @Default-Archive-Path "")
  1302.     (if (<> (substr installDirParent (- (strlen installDirParent) 1)) ":")
  1303.     (   (set installDirParent (cat installDirParent "/"))
  1304.     ))
  1305.     (set lhaCommand (cat lhaProgram " x -q -I \"%s\" " installDirParent))
  1306.  
  1307.     (set n 0)
  1308.     (set bit 1)
  1309.     (while (set installArchiveName (select n "base"
  1310.                          "inclib"
  1311.                          (cat "c" install020)
  1312.                          (cat "c++" install020)
  1313.                          (cat "objc" (substr install020 1))
  1314.                          "utils"
  1315.                          "doc"
  1316.                          "utildoc"
  1317.                          "diffs"
  1318.                          "texi"
  1319.                          ""
  1320.        ))
  1321.     (   (set installArchiveName (cat installName installVersionShort "-"
  1322.                      installArchiveName ".lha"))
  1323.         (if (BITAND gnuPackagesChoice bit)
  1324.         (   (UnpackArchive)
  1325.         ))
  1326.         (CompleteStep)
  1327.         (set bit (shiftleft bit 1))
  1328.         (set n (+ n 1))
  1329.     ))
  1330.     )
  1331.     (   (set completeLevel (+ completeLevel (* completeIncrement 10)))
  1332.     (CompleteStep)
  1333.     ))
  1334. )
  1335.  
  1336.  
  1337. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1338. ;;;
  1339. ;;;  ActionInstallation procedure
  1340. ;;;
  1341. ;;;  Executes the work which is unique for installing a new package:
  1342. ;;;  Unpacking the archive and renaming 020 binaries.
  1343. ;;;
  1344. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1345. (procedure ActionInstallation
  1346.  
  1347.     (SelectInstallDir)
  1348.     (UnpackArchives)
  1349.     (CreateNeededLinks)
  1350.     (Rename020Binaries)
  1351. )
  1352.  
  1353.  
  1354. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1355. ;;;
  1356. ;;;  ActionDeinstallation procedure
  1357. ;;;
  1358. ;;;  performs all steps needed for deinstalling an existing package.
  1359. ;;;
  1360. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1361. (procedure ActionDeinstallation
  1362.  
  1363.     (SelectDeinstallDir)
  1364.     (DeinstallGNU)
  1365. )
  1366.  
  1367.  
  1368. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1369. ;;;
  1370. ;;;  ActionConfiguration procedure
  1371. ;;;
  1372. ;;;  performs all steps needed for configuring an existing package.
  1373. ;;;
  1374. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1375. (procedure ActionConfiguration
  1376.  
  1377.     (SelectInstallDir)
  1378.     (CopyEnvironment)
  1379.     (SelectOSHeadersDir)
  1380.     (ModifyUserStartup)
  1381.     (CompleteStep)
  1382. )
  1383.  
  1384.  
  1385. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1386. ;;;
  1387. ;;;   main program
  1388. ;;;
  1389. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1390.  
  1391. (CheckOsVersion)
  1392. (ShowCopyrightMessage)
  1393.  
  1394. (CheckGNUDir)
  1395.  
  1396. (if oldInstallationSeen
  1397. (   (complete 0)
  1398.  
  1399.     (set repeatIt 1)
  1400.     (set defaultChoice 3)
  1401.     (while repeatIt
  1402.     (   (set actionChoice (askchoice
  1403.         (prompt "Please select actions to perform.")
  1404.         (help "Select \"Deinstall existing version\", if you want "
  1405.           "to remove an existing package.\n\n"
  1406.           "Select \"Install new version\", if you want to "
  1407.           "replace the existing version with a new version. "
  1408.           "Installing a new version implies reconfiguring it "
  1409.           "later.\n\n"
  1410.           "Select \"Configure existing version\", if you don't "
  1411.           "want to install a new version and just reconfigure "
  1412.           "an existing version.\n\n"
  1413.           "Select \"Done\", if you want to exit.\n\n"
  1414.           @askchoices-help
  1415.         )
  1416.         (choices "Deinstall existing version."
  1417.              "Install and configure new version"
  1418.              "Configure existing version"
  1419.              "All of the above"
  1420.              "Done"
  1421.         )
  1422.         (default defaultChoice)
  1423.     ))
  1424.  
  1425.     (set installDirAsked 0)
  1426.     (set asked020Binaries 0)
  1427.     (set askedInstallVersion 0)
  1428.     (set osHeadersDirSelected 0)
  1429.  
  1430.     (select actionChoice
  1431.     (   (set completeLevel 1)
  1432.         (set completeIncrement 33)
  1433.         (ActionDeinstallation)
  1434.         (set defaultChoice 1)
  1435.     )
  1436.     (   (set completeLevel -5)
  1437.         (set completeIncrement 5)
  1438.         (ActionInstallation)
  1439.         (ActionConfiguration)
  1440.         (set defaultChoice 4)
  1441.     )
  1442.     (   (set completeLevel 0)
  1443.         (set completeIncrement 20)
  1444.         (set configSubDir 1)
  1445.         (ActionConfiguration)
  1446.         (set configSubDir 0)
  1447.         (set defaultChoice 4)
  1448.     )
  1449.     (   (set completeLevel 4)
  1450.         (set completeIncrement 4)
  1451.         (ActionDeinstallation)
  1452.         (ActionInstallation)
  1453.         (ActionConfiguration)
  1454.         (set defaultChoice 4)
  1455.     )
  1456.     (   (set repeatIt 0)
  1457.     ))
  1458.     ))
  1459. )
  1460. (   (set completeLevel 0)
  1461.     (set completeIncrement 5)
  1462.  
  1463.     (message "GNU C is completely installed in one directory called GNU. "
  1464.          "Typical places are Work:GNU or similar.\n\n"
  1465.          "We start with selecting the parent directory of GNU, "
  1466.          "so that I can unarchive the LhA files to this place.\n"
  1467.          "An assign GNU: will lead to this directory later, binaries "
  1468.          "will be in GNU:bin, link libraries in GNU:lib and so on.\n\n"
  1469.          "If you have any problems with this installation script, send "
  1470.          "mail to\n"
  1471.          "jochen.wiedmann@neckar-alb.de"
  1472.     )
  1473.  
  1474.     (ActionInstallation)
  1475.     (ActionConfiguration)
  1476.  
  1477.     (message "Initial installation done. You may rerun me at any time "
  1478.          "to perform deinstallation, installing new versions or "
  1479.          "reconfiguring the existing package.\n\n"
  1480.          "Now you have to reboot to activate new environment.\n"
  1481.          "In case of errors, problems or whatever, please contact "
  1482.          "me at:\n\n"
  1483.          "email: phb@colombo.telesys-innov.fr\n"
  1484.          "fidonet: 2:320/104.21 Ramses The Amiga Flying BBS"
  1485.     )
  1486. ))
  1487.